package com.big.merchan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.big.merchan.mapper.MerchandiseStockMapper;
import com.big.merchan.service.MerchandiseStockService;
import com.big.model.model.stock.MerchandiseStock;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class MerchandiseStockServiceImpl extends ServiceImpl<MerchandiseStockMapper,MerchandiseStock> implements MerchandiseStockService {


    /**
     * 查看库存
     * @param mId
     * @return
     */
    @Override
    public MerchandiseStock infos(Long mId) {
        QueryWrapper<MerchandiseStock>wrapper=new QueryWrapper<>();
        wrapper.eq("m_id",mId);
        MerchandiseStock merchandiseStock = baseMapper.selectOne(wrapper);
        return merchandiseStock;
    }



    /**
     * 添加库存
     * @param merchandiseStock
     * @return
     */
    @Override
    public Integer SaveStock(MerchandiseStock merchandiseStock) {
        int insert = baseMapper.insert(merchandiseStock);
        return insert;
    }

}
